const parkorder = {
    parkingid: 0, //车位id
    ownerhouseid: 0, //用户身份id
    projectid: 0,
    companybuildingid: 0,
    parkingplanid: 0,
    parkingplanitemid: 0,
    parktype: 0, //第几步    0选付款方式   1选赠品    2返现金    3得汽车  4得车位   5确认车位
    payfull: 0, //付款方式-全款 0未启用 1启用
    payloan: 0, //付款方式-贷款 0未启用 1启用
    packageid: 0, //套餐id
    packagename: '', //套餐名字
    packagestate: 0, //拿赠品 0未启用 1启用
    coinstate: 0, //返现金 0未启用 1启用
    carstate: 0, //送汽车
    parkinginfo: [], //车位信息
    parkingplanitem: [], //营销活动明细
};

const UPDATE = 'update_parkorder';
const INIT = 'init_parkorder';

export default (state = parkorder, action) => {
    switch (action.type) {
        case UPDATE:
            return {...state, ...action.payload};
        case INIT:
            return{
                parkingid: 0, //车位id
                ownerhouseid: 0, //用户身份id
                projectid: 0,
                companybuildingid: 0,
                parkingplanid: 0,
                parkingplanitemid: 0,
                parktype: 0, //第几步    0选付款方式   1选赠品    2返现金    3得汽车  4得车位   5确认车位
                payfull: 0, //付款方式-全款 0未启用 1启用
                payloan: 0, //付款方式-贷款 0未启用 1启用
                packageid: 0, //套餐id
                packagename: '', //套餐名字
                packagestate: 0, //拿赠品 0未启用 1启用
                coinstate: 0, //返现金 0未启用 1启用
                carstate: 0, //送汽车
                parkinginfo: [], //车位信息
                parkingplanitem: [], //营销活动明细
            };
        default:
            return state;
    }
};

export const saveParkOrder = (payload) => {
    return {
        type: UPDATE,
        payload,
    };
};
export const initParkOrder = (payload) => {
    return {
        type: INIT,
        payload,
    };
};
